﻿using System.ComponentModel.DataAnnotations;

namespace WebAdmin.Models
{
    /// <summary>
    /// 登录 Request Model
    /// </summary>
    public class LoginModel
    {
        /// <summary>
        /// 账户
        /// </summary>
        [Required(ErrorMessage = "帐号不能为空")]
        public string LoginId { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [Required(ErrorMessage = "密码不能为空")]
        public string LoginPwd { get; set; }
    }

    /// <summary>
    /// 刷新 Token
    /// </summary>
    public class RefreshModel
    {
        /// <summary>
        /// 账户
        /// </summary>
        [Required(ErrorMessage = "帐号不能为空")]
        public string LoginId { get; set; }
        /// <summary>
        /// RefreshToken
        /// </summary>
        [Required(ErrorMessage = "RefreshToken不能为空")]
        public string RefreshToken { get; set; }
    }

    /// <summary>
    /// 登录视图实体
    /// </summary>
    public class LoginViewModel
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [Required]  //必填项
        [Display(Name = "用户名")]
        [RegularExpression(@"^\s*\w{1,}\s*$", ErrorMessage = "用户名为字母数字下划线")]
        public string UserName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        [RegularExpression(@"^\s*\w{6,}\s*$", ErrorMessage = "密码为6位以上字母数字下划线")]
        public string Password { get; set; }
        /// <summary>
        /// 验证码
        /// </summary>
        public string VerifyCode { get; set; }
        /// <summary>
        /// 用户IP
        /// </summary>
        public string UIP { get; set; }
    }
}
